﻿using System;
using System.Collections.Generic;
using QFramework;

namespace Gp.Scripts.Core
{
    public class GUIPanel : NRFramework.UIPanel
    {
        protected EventHandler EventHandler = new();


        protected sealed override void AfterCreated()
        {
            base.AfterCreated();
            OnEnter();
        }
        protected sealed override void OnCreating()
        {
            base.OnCreating();
        }

        /// <summary>
        /// 子类初始化唯一接口
        /// </summary>
        protected virtual void OnEnter() { }

        /// <summary>
        /// 子类析构唯一接口 
        /// </summary>
        protected virtual void OnExit() { }


        protected sealed override void InternalExit()
        {
            // 自动注销所有注册过的事件
            EventHandler.UnRegisterAll();
            OnExit();
        }


        protected sealed override void OnInternalRemoved()
        {
            base.OnInternalRemoved();
        }

        protected sealed override void OnInternalRemoving()
        {
            base.OnInternalRemoving();
        }
    }
}